package co.fitstart.entity.course;

import com.demo2do.core.utils.Alias;

/**
 * 
 * @author mohanlan
 * CourseRound用的很多，暂时不知道怎么去改
 */
@Alias("courseType")
public enum CourseType {
    
    ONLINE("online", "线上课程"),
    
    INDIVIDUAL("individual", "1v1常规课", "1v1常规"), // (黄色，1h，冻结60天，冻结次数跟随课时变化)
    
    GROUP("group", "线下团课", "团课"),
    
    YEAR("year", "周期卡课程", "周期卡"),  // 周期卡，橙色，1h（月卡，年卡，季卡，冻结时间和冻结次数不一样）
    
    SPECIAL("special", "1v1特色课", "1v1特色"),  // (蓝色，50min学员端，冻结60天，冻结次数跟随课时变化)
    
    POSTURE("posture", "1v1专项体态调整课", "1v1专项体态调整"),
    
    CARD("card", "会籍卡", "会籍卡");
    
    private CourseType(String alias, String description) {
        this.alias = alias;
        this.description = description;
    }
    
    private CourseType(String alias, String description, String other) {
        this.alias = alias;
        this.description = description;
        this.other = other;
    }
    
    private String alias;
    
    private String description;
    
    private String other;
    
	/**
     * 
     * @param alias
     * @return
     */
    public static CourseType aliasOf(String alias) {
        for (CourseType courseType : CourseType.values()) {
            if (courseType.getAlias().equalsIgnoreCase(alias)) {
                return courseType;
            }
        }
        
        return null;
    }
    
    public static CourseType[] getOffline() {
        return new CourseType[]{INDIVIDUAL, GROUP, YEAR, SPECIAL, POSTURE};
    }
    
    /**
     * 
     * @return
     */
    public String getShortName() {
        return String.valueOf(this.name().charAt(0));
    }
    
    /**
     * 
     * @return
     */
    public boolean supportAppointment() {
        return this.isIndividual() || this.isYear() || this.isSpecial() || this.isPosture();
    }
    
    /**
     * 
     * @return
     */
    public boolean isOnline() {
        return this.equals(ONLINE);
    }
    
    /**
     * 
     * @return
     */
    public boolean isIndividual() {
        return this.equals(INDIVIDUAL);
    }
    
    public boolean isSpecial() {
        return this.equals(SPECIAL);
    }
    
    public boolean isPosture() {
        return this.equals(POSTURE);
    }
    
    public boolean isCard() {
        return this.equals(CARD);
    }
    
    /**
     * 
     * @return
     */
    public boolean isGroup() {
        return this.equals(GROUP);
    }
    
    /**
     * 
     * @return
     */
    public boolean isYear() {
        return this.equals(YEAR);
    }
    
    /**
     * @return
     */
    public String getAlias() {
        return alias;
    }
    
    /**
     * @return
     */
    public String getDescription() {
        return description;
    }
    
    /**
     * @return
     */
    public String getOther() {
		return other;
	}
}
